package com.tanhua.server.config;

import com.tanhua.server.intercept.MyIntercept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptConf implements WebMvcConfigurer {

//     注入拦截器对象
    @Autowired
    private MyIntercept myIntercept;

    //拦截器配置
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myIntercept)
        .addPathPatterns("/**")//拦截的路径
        .excludePathPatterns("/user/login","/user/loginVerification");//排除哪些路径

    }
}
